package HCI.src;


import java.io.IOException;

import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.MediaController;
import android.widget.Toast;
import android.widget.VideoView;

public class Video extends Activity// implements SurfaceHolder.Callback 
{
	  public void onCreate(Bundle savedInstanceState) {

	        super.onCreate(savedInstanceState);
			EditText recipe = (EditText)findViewById(R.id.recipeName);

	        setContentView(R.layout.video);
	       	//Connector a = new Connector("SELECT rcpe_video_lnk FROM user WHERE rcpe_name ='"+recipe.getText().toString()+"'"+";");
	    	//String [][]A = //a.run();

	       	Log.d("hopa","lolo");
	        VideoView videoView = (VideoView)findViewById(R.id.VideoView01);
	        MediaController mediaController = new MediaController(this);
	        mediaController.setAnchorView(videoView);
	     //   Toast.makeText(null, "hello", 0);

	    	videoView.setKeepScreenOn(true);
	    	// Uri video = Uri.parse("file://moto_sounds.3gp");
	       
           // if(A[0][0].equals("working")){
    	    	videoView.setVideoPath("/data/moto_sounds.3gp");

            //}
	    //	videoView.setVideoPath("/data/moto_sounds.3gp");
	    	videoView.setMediaController(mediaController);
	    	if (videoView.canSeekForward())
	    	videoView.seekTo(videoView.getDuration()/2);
	    	videoView.start();

	    	
	        Button register = (Button)findViewById(R.id.SingoutVideo);
		    register.setOnClickListener(new View.OnClickListener(){ 
		    	public void onClick(View view) {
					Intent switchToRegistration = new Intent(view.getContext(), HCI1Login.class);
					
					startActivity(switchToRegistration);
		    	}
		    }
		    	);
		   
	    }
	
}